Docker+gitlab+jenkins实现项目自动部署

您所在的位置:网站首页 gitlab pages 安装 Docker+gitlab+jenkins实现项目自动部署

Docker+gitlab+jenkins实现项目自动部署

#Docker+gitlab+jenkins实现项目自动部署| 来源: 网络整理| 查看: 265

Docker+gitlab+jenkins实现项目自动部署 一、Docker安装(CentOS) 1、准备工作

系统要求

以下为官网原文

To install Docker Engine, you need a maintained version of CentOS 7 or 8. Archived versions aren’t supported or tested.

The centos-extras repository must be enabled. This repository is enabled by default, but if you have disabled it, you need to re-enable it.

The overlay2 storage driver is recommended.

Docker 支持 64 位版本 CentOS 7/8,并且要求内核版本不低于 3.10。 CentOS 7 满足最低内核的要求,但由于内核版本比较低,部分功能(如 overlay2 存储层驱动)无法使用,并且部分功能可能不太稳定。

卸载旧版本

旧版本的Docker被称为Docker或Docker -engine。 如果安装了这些组件,运行以下命令进行卸载:

$ sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-selinux \ docker-engine-selinux \ docker-engine 复制代码

CentOS8额外设置

由于 CentOS8 防火墙使用了 nftables,但 Docker 尚未支持 nftables, 我们可以使用如下设置使用 iptables:

更改 /etc/firewalld/firewalld.conf

# FirewallBackend=nftables FirewallBackend=iptables 复制代码 2、使用仓库方式进行安装

设置仓库

在新主机上首次安装Docker引擎之前,需要设置Docker仓库。安装yum-utils包(用到yum-config-manager工具)并设置仓库,鉴于国内网络问题,强烈建议使用国内源,官方源请在注释中查看。

$ sudo yum install -y yum-utils $ sudo yum-config-manager \ --add-repo \ https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo # 官方源 # $ sudo yum-config-manager \ # --add-repo \ # https://download.docker.com/linux/centos/docker-ce.repo 复制代码

如果需要测试版本的 Docker 请执行以下命令:

$ sudo yum-config-manager --enable docker-ce-test 复制代码

安装Docker引擎

安装最新版本的Docker Engine和容器

$ sudo yum install docker-ce docker-ce-cli containerd.io 复制代码 3、启动Dokcer $ sudo systemctl enable docker $ sudo systemctl start docker 复制代码 4、测试Docker安装是否正确 $ docker run --rm hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 2db29710123e: Pull complete Digest: sha256:cc15c5b292d8525effc0f89cb299f1804f3a725c8d05e158653a563f15e4f685 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/ 复制代码 5、后置配置

镜像加速

使用阿里云镜像加速服务

sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json 提示


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3